<div class="layui-container fly-marginTop fly-user-main">
  {include file='common/menu'/}

  <div class="fly-panel fly-panel-user" pad20>
    <!--
      <div class="fly-msg" style="margin-top: 15px;">
        您的邮箱尚未验证，这比较影响您的帐号安全，<a href="activate.html">立即去激活？</a>
      </div>
      -->
    <div class="layui-tab layui-tab-brief" lay-filter="user">
      <ul class="layui-tab-title" id="LAY_mine">
        <li data-type="mine-jie" lay-id="index" class="layui-this">全部积分记录（<span>{$AllRecord}</span>）</li>
        <li data-type="collection" data-url="/collection/find/" lay-id="collection">发布记录（<span>{$StateOne|count}</span>）
        </li>
        <li data-type="collection" data-url="/collection/find/" lay-id="collection">采纳记录（<span>{$StateTwo|count}</span>）
        </li>
        <li data-type="collection" data-url="/collection/find/" lay-id="collection">
          充值记录（<span>{$StateThree|count}</span>）</li>
        <li data-type="collection" data-url="/collection/find/" lay-id="collection">
          签到记录（<span>{$StateFour|count}</span>）</li>
      </ul>
      <div class="layui-tab-content" style="padding: 20px 0;">
        <div class="layui-tab-item layui-show">
          <ul class="mine-view jie-row">
            {foreach $recordList as $item}
            <li>
              <a class="jie-title" href="../jie/detail.html" target="_blank">{$item.content}</a>
              <i>{$item['createtime']}</i>
              <a class="mine-edit del" href="JavaScript:;" data-id="{$item.id}"
                style="float: right;margin-right: 100px;">删除</a>
            </li>
            {/foreach}
          </ul>
          {$recordList->render()}
          <div id="LAY_page"></div>
        </div>
        <div class="layui-tab-item">
          <ul class="mine-view jie-row">
            {foreach $StateOne as $item}
            <li>
              <a class="jie-title" href="../jie/detail.html" target="_blank">{$item.content}</a>
              <i>{$item['createtime']}</i>
              <a class="mine-edit del" href="JavaScript:;" data-id="{$item.id}"
                style="float: right;margin-right: 100px;">删除</a>
            </li>
            {/foreach}
          </ul>
          {$StateOne->render()}
          <div id="LAY_page1"></div>
        </div>
        <div class="layui-tab-item">
          <ul class="mine-view jie-row">
            {foreach $StateTwo as $item}
            <li>
              <a class="jie-title" href="../jie/detail.html" target="_blank">{$item.content}</a>
              <i>{$item['createtime']}</i>
              <a class="mine-edit del" href="JavaScript:;" data-id="{$item.id}"
                style="float: right;margin-right: 100px;">删除</a>
            </li>
            {/foreach}
          </ul>
          {$StateTwo->render()}
          <div id="LAY_page2"></div>
        </div>
        <div class="layui-tab-item">
          <ul class="mine-view jie-row">
            {foreach $StateThree as $item}
            <li>
              <a class="jie-title" href="../jie/detail.html" target="_blank">{$item.content}</a>
              <i>{$item['createtime']}</i>
              <a class="mine-edit del" href="JavaScript:;" data-id="{$item.id}"
                style="float: right;margin-right: 100px;">删除</a>
            </li>
            {/foreach}
          </ul>
          {$StateThree->render()}
          <div id="LAY_page3"></div>
        </div>
        <div class="layui-tab-item">
          <ul class="mine-view jie-row">
            {foreach $StateFour as $item}
            <li>
              <a class="jie-title" href="../jie/detail.html" target="_blank">{$item.content}</a>
              <i>{$item['createtime']}</i>
              <a class="mine-edit del" href="JavaScript:;" data-id="{$item.id}"
                style="float: right;margin-right: 100px;">删除</a>
            </li>
            {/foreach}
          </ul>
          {$StateFour->render()}
          <div id="LAY_page4"></div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
  layui.use(['layer'], function () {
    let $ = layui.jquery,
      layer = layui.layer

    // let postid = $('.del').data('id')
    // console.log(postid);

    $('.del').click(function () {
      let recordid = $(this).data('id')

      layer.confirm('确认删除积分记录？', { icon: 3, title: '提示' }, function (index) {
        //发起请求
        $.ajax({
          type: 'post',
          url: `{:url('home/user/del')}`,
          data: {
            recordid
          },
          dataType: 'json',
          success: function (res) {
            if (res.code === 1) {
              layer.msg('删除成功', { icon: 1 }, function (index) {
                location.href = res.url
              })
            } else {
              layer.msg(res.msg, { icon: 5 })
            }
          }
        })

        layer.close(index)
      })
    })

  })
</script>